#ifndef AVALON_MOCKSERVICELOCATORDATASTORE_HPP
#define AVALON_MOCKSERVICELOCATORDATASTORE_HPP
#include "Avalon/ServiceLocator/ServiceLocatorDataStore.hpp"
#include "Avalon/ServiceLocatorTests/ServiceLocatorTests.hpp"

namespace Avalon {
namespace ServiceLocator {
namespace Tests {

  /*! \class MockServiceLocatorDataStore
   *  \brief Data store used for testing purposes.
   */
  class MockServiceLocatorDataStore : public ServiceLocatorDataStore {
    public:

      //! Constructs a MockServiceLocatorDataStore.
      MockServiceLocatorDataStore();

      virtual ~MockServiceLocatorDataStore();

      virtual int LoadAccountCount();

      virtual DirectoryEntry::Tag LoadTag(unsigned int id);

      virtual DirectoryEntry::Tag LoadParentTag(unsigned int id);

      virtual DirectoryEntry::Tag LoadAccountTag(const std::string& name);

      virtual unsigned int CreateDirectory(const std::string& name,
        const DirectoryEntry::Tag& directory);

      virtual void DeleteDirectory(unsigned int id);

      virtual void MoveEntry(unsigned int id, unsigned int directory);

      virtual std::vector<DirectoryEntry::Tag> LoadDirectoryEntries(
        unsigned int id);

      virtual unsigned int CreateAccount(const std::string& name,
        const DirectoryEntry::Tag& directory);

      virtual std::string LoadPassword(unsigned int account);

      virtual void DeleteAccount(unsigned int id);

      virtual void SetPassword(unsigned int account,
        const std::string& password);

      virtual std::map<unsigned int, Directory::Permission> LoadPermissions(
        unsigned int id);

      virtual Directory::Permission LoadAccountPermissions(unsigned int account,
        unsigned int directory);

      virtual void SetPermissions(unsigned int account, unsigned int directory,
        Directory::Permission permissions);

      virtual std::vector<std::string> GetUnavailableNames();

      virtual bool IsNameAvailable(const std::string& name);

      virtual void AddUnavailableName(const std::string& name);

      virtual void RemoveUnavailableName(const std::string& name);

      virtual void Open();

      virtual bool IsOpen() const;

      virtual void Close();

      virtual void SetClosedSlot(const ClosedSlot& slot, Out<bool> isOpen);

    private:
      bool m_isOpen;
      unsigned int m_nextId;
      std::map<unsigned int, DirectoryEntry*> m_idToEntry;
      std::map<std::string, unsigned int> m_nameToId;
      std::map<unsigned int, std::string> m_accountToPassword;
      std::map<unsigned int, unsigned int> m_idToParent;
      std::map<unsigned int, std::map<unsigned int, Directory::Permission> >
        m_permissions;
      std::vector<std::string> m_unavailableNames;
      mutable boost::shared_ptr<ClosedSlot> m_closedSlot;
  };
}
}
}

#endif // AVALON_MOCKSERVICELOCATORDATASTORE_HPP
